package com.sooncode.project.focusservice.controller;

import com.sooncode.project.focusservice.model.CourseType;
import com.sooncode.project.focusservice.service.CourseTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("courseType")
public class CourseTypeController {
    @Autowired
    private CourseTypeService service;
    @PostMapping("courseType")
    public boolean add(@RequestParam Map map){
        return service.add(map);
    }
    @PutMapping("courseType")
    public boolean modify(@RequestParam String id,@RequestParam Map map){
        map.remove("id");
        return service.modify(id,map);
    }
    @DeleteMapping("courseType")
    public boolean delete(@RequestParam String[] ids){
        for(String id:ids){
            service.delete(id);
        }
        return true;
    }
    @GetMapping("courseTypes")
    public List<CourseType> getList(){
        return service.getList();
    }

}
